#include<stdio.h>
//找区间内的回文数
//核心功能 回文数的判断
//采用思路：求倒数（倒过来的数）
int Judge(int num) {
	int temp = 0;
	int contrary_num = 0;
	for (int i = num; i; i /= 10) {
		temp = i % 10;
		contrary_num = 10 * contrary_num + temp;
	}
	return contrary_num == num;
}
int main() {
	int n, count;
	scanf("%d", &n);
	count = 0;
	for (int i = 0; i < n; i++) {
		if (Judge(i)) {
			printf("%d,",i);
			count++;
		}
		if (count == 10) {
			printf("\n");
			count = 0;
		}
	}
	return 0;
}